<template>
  <div id="app">
    <Header></Header>
    <!-- 路由出口 -->
    <router-view></router-view>
    <!-- 控制footer的显示与隐藏，但组件数量太多时就不合适了，判断过于复杂 -->
    <!-- <Footer v-show="$route.path=='/home'||$route.path=='/Search'"></Footer> -->
    <!-- 通过路由元信息来进行判断，在每个路由里面添加meta字段，用于判断 -->
    <Footer v-show="$route.meta.show"></Footer>
  </div>
</template>

<script>
import Header from "@/components/header/index.vue"
import Footer from '@/components/footer/index.vue'
export default {
  name: 'App',
  components: {
    Header,
    Footer,
  },
  mounted () {
    // 发送请求,获取全部商品分类列表
    this.$store.dispatch("categeory");
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
